;;; basic-key-bindings.el - user defined key bindings.
;;;  
;;; Copyright (C) 2011 Jeffy Du
;;;  
;;; Author: Jeffy Du (cmdxiaoha@163.com)
;;; Create: 2011-12-23 09:53:47
;;; Last Modified: 2011-12-30 09:36:03
;;;  
;;; History:
;;; --------
;;; 2011-12-23  v0.1  Jeffy Du (cmdxiaoha@163.com)
;;;     1. Initial revision.

;; Auto indent after newline.
(define-key global-map (kbd "\r") 'newline-and-indent)

;; Record most recently used file.
(recentf-mode t)
(define-key global-map (kbd "C-x C-r") 'recentf-open-files)
(define-key recentf-dialog-mode-map (kbd "n") 'widget-forward)
(define-key recentf-dialog-mode-map (kbd "p") 'widget-backward)

;; Use ibuffer to management buffers.
(define-key global-map (kbd "C-x C-b") 'ibuffer)

;; Use hippie expand.
(define-key global-map (kbd "M-/") 'hippie-expand)

;; Copy & Cut
(define-key global-map (kbd "C-w") 'my-kill-region-or-lines)
(define-key global-map (kbd "M-w") 'my-copy-region-or-lines)

;; Kill line to begin.
(define-key global-map (kbd "C-\\") 'my-kill-to-begin)

;; Translate case for current char.
(define-key global-map (kbd "C-^") 'my-case-trans)

;; Goto matched parentheses.
(define-key global-map (kbd "C-%") 'my-goto-paren)

;; Comment & Uncomment.
(define-key global-map (kbd "C-c C-c") 'my-comment-or-uncomment-region-or-line)

;; Forward search current word.
(define-key global-map (kbd "M-s M-s") 'my-isearch-forword-cur-word)

;; Find char forword.
(define-key global-map (kbd "C-x f") 'my-goto-char)

;; Set mark.
(define-key global-map (kbd "C-c C-v") 'my-mark-something-at-point)

;; Hide/Show.
(define-key global-map (kbd "C-c SPC") 'hs-toggle-hiding)
(define-key global-map (kbd "C-c h") 'hs-hide-all)
(define-key global-map (kbd "C-c s") 'hs-show-all)

;; Fast set and jump to register.
(define-key global-map (kbd "C-,") 'my-point-to-register)
(define-key global-map (kbd "C-.") 'my-jump-to-register)

;; Jump to line
(define-key global-map (kbd "C-x g") 'goto-line)

;; execute emacs shell
(define-key global-map (kbd "C-x c") 'eshell)